package main

import (
	"fmt"
	"sync"
	"time"
)

/*
*
改造如下
*/
func worker3(id int, wg *sync.WaitGroup) {
	defer wg.Done()
	fmt.Printf("worker %d starting work\n", id)
	time.Sleep(time.Second)
	fmt.Printf("worker %d end work\n", id)
	fmt.Println()
}

// func main() {
// 	var wg sync.WaitGroup
// 	size := 10
// 	wg.Add(size)
// 	for i := 0; i < size; i++ {
// 		go worker3(i, &wg)
// 	}
// 	wg.Wait()
// 	fmt.Println("main end~~~")
// }
